/*
 * Copyright (c)  2015~2020, xforceplus
 * All rights reserved.
 * Project:datacare-orm
 * Id: UpdateBatchMapperInvoke.java   2020-09-30 09-18-27
 * Author: Evan
 */
package cn.datacare.orm.mapper.inovke;

import cn.datacare.orm.manager.impl.SQLManager;
import cn.datacare.orm.mapper.MapperInvoke;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: 2015~2020
 * </p>
 * <p>
 * Company/Department: xforceplus
 * </p>
 *
 * @author Evan
 * <b>Creation Time:</b> 2020-09-30 09-18-27
 * @since V1.0
 */
public class UpdateBatchMapperInvoke implements MapperInvoke {

    @Override
    public Object call(SQLManager sm, Class entityClass, String sqlId, Method m, Object[] args) {

        if (args[0] instanceof List) {
            return sm.updateBatch(sqlId, (List) args[0]);
        }
        return sm.updateBatch(sqlId, (Map<String, Object>[]) args[0]);
    }
}
